<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>编辑</title>
	<!-- jsp文件头和头部 -->
	<%@ include file="/WEB-INF/views/layout/top.jsp"%> 
    <script type="text/javascript">
    	$(function(){
    		//加载时间控件 -- 需要的话解开
        	//layui.use('laydate', function(){});
    		$("#form1").formEdit($.parseJSON('${r"${"}pd${r"}"}'));
    	});
		// 检测
		function save(){
			if (!judgeValidate('#form1')) 
	              return ;

			var params = getFormJson("form1");
			ajax("<%=root%>${classNameLower}/save.do",params,function(rsp){
				 if(rsp.status){
					showSuccMsg(rsp.message);
	                refreshCurrTab();
	                closeDlg();
				 }else{
					showErrorMsg(rsp.message);
				 }
			});
		}
    </script>
</head>
<body>
	 <form name="form1" id="form1" method="post" class="layui-form">
	 	<!--主键id，可能需要修改-->
    	<input type="hidden" name="${pKey[1]}" value="${r"${"}pd.${pKey[1]}${r"}"}"/>
        <table border="0" cellpadding="0" cellspacing="0" class="frm">
    	<#list fieldList as var>
		  <#if var[0] != '${pKey[1]}' && var[0] != 'addTime' && var[0] != 'addUid' && var[0] != 'modifyTime' && var[0] != 'modifyUid'>
			<#if var[1] == 'Date'>
				<tr>
					<th>${var[3] }:</th>
					<td>
						<input type="text" class="layui-input" name="${var[0] }" placeholder="${var[3] }" value="${r"${pd."}${var[0] }${r"}"}" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
							   err="${var[3] }"/>
					</td>
				</tr>
			<#elseif var[1] == 'Integer'>
				<tr>
					<th>${var[3] }:</th>
					<td>
						<input type="number" class="layui-input" name="${var[0] }" placeholder="${var[3] }" value="${r"${pd."}${var[0] }${r"}"}" 
							   datacol="no" checkexpession="Num" err="${var[3] }"/>
					</td>
				</tr>
			<#else>
				<tr>
					<th>${var[3] }:</th>
					<td>
						<input type="text" class="layui-input" name="${var[0] }" placeholder="${var[3] }" value="${r"${pd."}${var[0] }${r"}"}" maxlength="32"
							   datacol="no" checkexpession="NotNull" err="${var[3] }"/>
					</td>
				</tr>
			</#if>
		 </#if>
	   </#list>
       </table>
       <%@ include file="/WEB-INF/views/layout/footer.jsp"%> 
    </form>
</body>
</html>